//
//  XTTableViewCell.m
//  TTLestening
//
//  Created by dllo on 16/3/22.
//  Copyright © 2016年 dilo. All rights reserved.
//

#import "XTTableViewCell.h"
#import <SDWebImage/UIButton+WebCache.h>
#import <SDWebImage/UIImageView+WebCache.h>
#import "XCModelForFind.h"
#import "XTVCOfdiantai.h"
@interface XTTableViewCell ()

@property (weak, nonatomic) IBOutlet UIButton *buttonpaihangbang;

@property (weak, nonatomic) IBOutlet UILabel *labelpaihangpang;

@property (weak, nonatomic) IBOutlet UIButton *buutongedan;

@property (weak, nonatomic) IBOutlet UILabel *labelgedan;
@property (weak, nonatomic) IBOutlet UIButton *buutondiantai;
@property (weak, nonatomic) IBOutlet UILabel *labeldiantia;
@property (weak, nonatomic) IBOutlet UIButton *buttongeshou;
@property (weak, nonatomic) IBOutlet UILabel *labelgeshou;

@end

@implementation XTTableViewCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)passModel:(NSArray *)array {

    
    XCModelForFind *model = [array objectAtIndex:0];
    [self.buttonpaihangbang sd_setBackgroundImageWithURL:[NSURL URLWithString:model.picUrl] forState:UIControlStateNormal];
    self.labelpaihangpang.text = model.name;
    [self.buttonpaihangbang addTarget:self action:@selector(appearpaihangbang:) forControlEvents:UIControlEventTouchUpInside];
    
    
    XCModelForFind *modelForGeDan = [array objectAtIndex:1];
    [self.buutongedan sd_setBackgroundImageWithURL:[NSURL URLWithString:modelForGeDan.picUrl] forState:UIControlStateNormal];
    self.labelgedan.text = modelForGeDan.name;
    [self.buutongedan addTarget:self action:@selector(songsMenu:) forControlEvents:UIControlEventTouchUpInside];
    
    
    XCModelForFind *modelForDianTai = [array objectAtIndex:2];
    [self.buutondiantai sd_setBackgroundImageWithURL:[NSURL URLWithString:modelForDianTai.picUrl] forState:UIControlStateNormal];
    self.labeldiantia.text = modelForDianTai.name;
    
    [self.buutondiantai addTarget:self action:@selector(appeardiantai:) forControlEvents:UIControlEventTouchUpInside];
    
    
    XCModelForFind *modelForSinger = [array objectAtIndex:3];
    [self.buttongeshou sd_setBackgroundImageWithURL:[NSURL URLWithString:modelForSinger.picUrl] forState:UIControlStateNormal];
    self.labelgeshou.text = modelForSinger.name;
    [self.buttongeshou addTarget:self action:@selector(singerAction:) forControlEvents:UIControlEventTouchUpInside];
    
}
     
-(void)appeardiantai:(UIButton *)button{

    NSLog(@"出现电台界面");
  
    
    [[NSNotificationCenter defaultCenter] postNotificationName:@"pushDiantai" object:nil];
    
}
- (void)singerAction:(UIButton *) button {

    [[NSNotificationCenter defaultCenter] postNotificationName:@"pushSinger" object:nil];


}
- (void)appearpaihangbang:(UIButton *) button{
    
    [[NSNotificationCenter defaultCenter] postNotificationName:@"pushPaihangbang" object:nil];
    
    
}



- (void)songsMenu:(UIButton *) button{


    [[NSNotificationCenter defaultCenter] postNotificationName:@"songMenu" object:nil];


}



- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
